from docx import Document
from docx.enum.section import WD_ORIENT, WD_ORIENTATION, WD_SECTION_START

doc = Document()
doc.add_paragraph("te")
section = doc.add_section(start_type=WD_SECTION_START.CONTINUOUS)
section.orientation = WD_ORIENTATION.LANDSCAPE
page_h, page_w = section.page_width, section.page_height
section.page_width = page_w
section.page_height = page_h
doc.save(r'D:\Desktop\word\h.docx')




